import React, { useContext } from 'react';
import contextObj from './context'
const Child2 = () => {
    const { state, dispatch } = useContext(contextObj)
    return (
        <div>
            child2
            <p onClick={() => {
                dispatch({ type: 'editname', payload: '董宇航' })
            }}>{state.userinfo.name}--{state.userinfo.age}</p>
        </div>
    );
}

export default Child2;
